@layout("/common/_container.html",{js:["/assets/modular/system/project/project_thingsNew.js"]}){
<style>
    .input {
        border: none;
        border-bottom: 1px solid #E5E5E5;
    }

    .editinput {
        width: 60px;
    }

    .address {
        width: 96%;
    }

    .bz {
        width: 100%;
    }

    .layui-table tbody tr:hover,
    .layui-table thead tr,
    .layui-table-click,
    .layui-table-header,
    .layui-table-hover,
    .layui-table-mend,
    .layui-table-patch, .layui-table-tool,
    .layui-table-total, .layui-table-total tr, .layui-table[lay-even] tr:nth-child(even) {
        background-color: #FFFFFF;
    }

    td {
        /*white-space: nowrap;*/
        word-wrap:break-word;
        word-break:break-all;
        height: 32px;
        padding-left: 15px;
    }

    .btnshop {
        display: inline-block;
        height: 28px;
        line-height: 28px;
        padding: 0 10px;
        background-color: #10B0C6;
        color: #fff;
        white-space: nowrap;
        text-align: center;
        font-size: 12px;
        border: none;
        border-radius: 2px;
        cursor: pointer;
        margin-bottom: 10px;
    }

    .blur {
        border: 1px solid red;
    }

    .testdiv {
        margin-top: 50px;
        margin-bottom: 180px;
    }

    .xmdz {
        width: 80%;
    }

    .ylt {
        width: 80%;
        margin-top: 10px;
        display: inline-block
    }

    .ggylt {
        /*margin-left: -117px;*/
        /*width: 132%;*/
        margin-top: 10px;
        /*display: inline-block;*/
    }

    .sjspan {
        padding-right: 15px;
    }

    .uploader-list .info {
        position: relative;
        margin-top: -25px;
        background-color: black;
        color: white;
        filter: alpha(Opacity=80);
        -moz-opacity: 0.5;
        opacity: 0.5;
        width: 80px;
        height: 25px;
        text-align: center;
        display: none;
    }
    .uploader-list .handle {
        position: relative;
        background-color: black;
        color: white;
        filter: alpha(Opacity=80);
        -moz-opacity: 0.5;
        opacity: 0.5;
        width: 80px;
        text-align: right;
        height: 25px;
        margin-bottom: -18px;
        display: none;
    }

    .uploader-list .handle span {
        margin-right: 10px;
        font-size: 14px;
    }

    .uploader-list .handle span:hover {
        cursor: pointer;
    }

    .uploader-list .file-item {
        margin: 12px 0 0 15px;
        padding: 1px;
        float: left;
    }
    html {
        background-color: #FFF;
        overflow-x:scroll;
    }
    .swTable{
        width: 90%;
        max-width: 720px;
        margin: 0 auto;
        /*border-color: #e1e2e6;*/
    }
    .swTables{
        table-layout: fixed;
        border-color: #e1e2e6;
    }
    input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{
        font-size:12px;
    }
    .zlinput{
        width: 45px;
        text-align: center;
    }
    .console-bar {
        position: fixed;
        background-color: #FFFFFF8F;
        width: 100%;
        z-index: 20;
        top: 0;
        left: 0;
        right: 0;
        margin: 0;
    }
    .console-bar>button {
        text-align: right;
        margin-top: 10px;
        margin-left: 20px;
    }
    .input {
        color: #0000FF;
    }
    .rent-year-remove {
        height: 18px;
        line-height: 18px;
        float: right;
        margin-right: 10px;
        display: none;
        cursor: pointer;
    }
    .rent-year-remove:last-child {
        display: inline-block;
    }
    .add-year {
        height: 18px;
        line-height: 18px;
        float: right;
        margin-right: 10px;
        cursor: pointer;
    }
    .el-tabs__item:hover{
        color: #10b1c6 !important;
    }
    .el-tabs__item.is-active{
        color: #10b1c6 !important;
    }
</style>
</head>
<body>
<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
<script src="/assets/common/module/vuejs/vue.dev.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="/assets/common/module/element-ui/lib-master/theme-chalk/index.css">
<link rel="stylesheet" href="/assets/common/module/element-ui/lib-master/theme-chalk/display.css">
<link rel="stylesheet" href="/assets/common/css/beautiful.css">
<style>
    .el-input-group__append, .el-input-group__prepend {
        padding: 0 10px;
    }
    .upload .el-form-item__content {
        width: 148px;
        height: 148px;
        overflow: hidden;
    }
    .el-upload img {
        max-width: 140px;
        max-height: 140px;
    }
    .el-form-item__error {
        padding-top: 0;
        margin-top: -5px;
        z-index: 22;
        right: 0;
        left: initial;
    }
    .upload .el-form-item__error {
        width: 100%;
        text-align: center;
        margin-top: -40px;
    }

    .el-input.is-disabled .el-input__inner {
        border-color: #DCDFE6;
        color: #3f4450;
    }
</style>
<!-- 引入组件库 -->
<script src="/assets/common/module/element-ui/lib-master/index.js"></script>

<div id="app">
    <div class="el-p-l-30 el-p-r-30" style="width: 96%; max-width: 700px; margin: 80px auto 140px">
        <el-form ref="form" :rules="rules" ref="form" :model="form" label-width="110px">
            <el-divider content-position="center">1. 项目基本信息</el-divider>
            <el-form-item label="项目地址" prop="itemAddress">
                <el-input
                        size="small"
                        type="textarea"
                        :autosize="{ minRows: 1, maxRows: 2}"
                        placeholder="请输入项目地址"
                        :disabled="readOnly"
                        v-model="form.itemAddress"
                />
            </el-form-item>
            <el-form-item label="落位图" prop="zswztimg" class="upload" style="margin-bottom: 80px">
                <el-upload
                        accept="image/jpeg,image/png"
                        list-type="picture-card"
                        :limit="1"
                        :disabled="readOnly"
                        :file-list="zswztimgList"
                        :action="uploadAction"
                        :on-success="handleZswztimgSuccess"
                        :on-preview="handleZswztimgPictureCardPreview"
                        :on-remove="handleZswztimgRemove">
                    <i class="el-icon-plus"></i>
<!--                    <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>-->
                </el-upload>
                <el-dialog :visible.sync="zswztimgDialogVisible">
                    <img width="100%" :src="form.zswztimg" alt="">
                </el-dialog>
            </el-form-item>

            <el-divider content-position="center">2. 联络人员</el-divider>

            <el-form-item
                    label="开发人员">
                <el-col :sm="20" :md="11">
                    <el-form-item prop="kfry">
                        <el-input
                                size="small"
                                placeholder="请输入姓名"
                                :disabled="readOnly"
                                v-model="form.kfry">
                            <template slot="prepend">姓名</template>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1" >&nbsp;</el-col>
                <el-col :sm="20" :md="11">
                    <el-form-item prop="ry">
                        <el-input
                                size="small"
                                placeholder="请输入手机"
                                :disabled="readOnly"
                                v-model="form.ry">
                            <template slot="prepend">手机</template>
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-form-item>

            <el-form-item
                    label="招商负责人"
                    style="margin-bottom: 80px">
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="sw">
                    <el-input
                            size="small"
                            placeholder="请输入姓名"
                            :disabled="readOnly"
                            v-model="form.sw">
                        <template slot="prepend">姓名</template>
                    </el-input>
                    </el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="djr">
                    <el-input
                            size="small"
                            :disabled="readOnly"
                            placeholder="请输入手机"
                            v-model="form.djr">
                        <template slot="prepend">手机</template>
                    </el-input>
                    </el-form-item>
                </el-col>
            </el-form-item>

            <el-divider content-position="center">3. 商务条款</el-divider>

            <el-form-item
                    label="租赁面积">
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="zlArea">
                    <el-input
                            size="small"
                            placeholder="请输入租赁实用面积"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.zlArea">
                        <template slot="prepend">实用面积</template>
                        <template slot="append">㎡</template>
                    </el-input>
                    </el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="zlAreaBuild">
                        <el-input
                                size="small"
                                placeholder="请输入租赁建筑面积"
                                :verify-number="true"
                                :clearable="false"
                                :disabled="readOnly"
                                v-model="form.zlAreaBuild">
                            <template slot="prepend">建筑面积</template>
                            <template slot="append">㎡</template>
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="waibaiArea">
                    <el-input
                            size="small"
                            placeholder="请输入外摆区面积"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.waibaiArea">
                        <template slot="prepend">外摆区</template>
                        <template slot="append">㎡</template>
                    </el-input>
                    </el-form-item>
                </el-col>
            </el-form-item>

            <el-form-item
                    label="租赁时间">
                <el-col :sm="20" :md="6">
                    <el-form-item
                            prop="zlTime">
                    <el-input
                            size="small"
                            placeholder="请输入月份"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model.number="form.zlTime">
                        <template slot="prepend">月数</template>
                    </el-input>
                    </el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                <el-col :sm="20" :md="6">
                    <el-form-item
                            prop="zlTime1">
                    <el-input
                            size="small"
                            placeholder="请输入天数"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model.number="form.zlTime1">
                        <template slot="prepend">天数</template>
                    </el-input>
                    </el-form-item>
                </el-col>
            </el-form-item>

            <el-form-item
                    label="免租时间">
                <el-col :sm="20" :md="6">
                    <el-form-item
                            prop="mzTime">
                    <el-input
                            size="small"
                            placeholder="请输入月份"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model.number="form.mzTime">
                        <template slot="prepend">月数</template>
                    </el-input>
                    </el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                <el-col :sm="20" :md="6">
                    <el-form-item
                            prop="mzTime1">
                    <el-input
                            size="small"
                            placeholder="请输入天数"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model.number="form.mzTime1">
                        <template slot="prepend">天数</template>
                    </el-input>
                    </el-form-item>
                </el-col>
            </el-form-item>

            <el-form-item
                    label="租金(元/月)">
                <el-col :sm="20" :md="8" v-for="(item, index) in form.taxes"
                        :key="index" style="padding-right: 15px">
                    <el-form-item
                            :prop="'taxes.'+index"
                            :rules="[
                                { required: true, message: '请输入租金', trigger: 'blur' }
                            ]">
                    <el-input
                            size="small"
                            placeholder="请输入金额"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.taxes[index]">
                        <template slot="prepend">第{{index + 1}}年</template>
                        <template slot="append" v-if="(form.taxes.length - 1 == index && index > 2) && !readOnly">
                            <span v-on:click="removeTaxes" style="cursor: pointer"><i class="el-icon-delete"></i></span>
                        </template>
                    </el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24" v-if="!readOnly"><span v-on:click="addRent" style="color: #10B0C6; cursor: pointer"><i class="el-icon-circle-plus" style="margin-right: 6px"></i>新增一年</span></el-col>
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="ccxst">
                    <el-input
                            size="small"
                            placeholder="请输入抽成形式"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.ccxst">
                        <template slot="prepend">抽成形式(%)</template>
                    </el-input></el-form-item>
                </el-col>
                <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                <el-col :sm="20" :md="11">
                    <el-form-item
                            prop="qt">
                    <el-input
                            size="small"
                            placeholder="请输入其他形式"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.qt">
                        <template slot="prepend">其他形式</template>
                    </el-input></el-form-item>
                </el-col>
            </el-form-item>

            <el-form-item
                    label="费用(元/月)">
                <el-col :sm="20" :md="8" style="padding-right: 15px">
                    <el-form-item
                            prop="waterFee">
                    <el-input
                            size="small"
                            placeholder="请输入水费"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.waterFee">
                        <template slot="prepend">水费</template>
                    </el-input></el-form-item>
                </el-col>
                <el-col :sm="20" :md="8" style="padding-right: 15px">
                    <el-form-item
                            prop="eleFee">
                    <el-input
                            size="small"
                            placeholder="请输入电费"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.eleFee">
                        <template slot="prepend">电费</template>
                    </el-input></el-form-item>
                </el-col>

                <el-col :sm="20" :md="8" style="padding-right: 15px">
                    <el-form-item
                            prop="wuyeFee">
                    <el-input
                            size="small"
                            placeholder="请输入物业费"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.wuyeFee">
                        <template slot="prepend">物业费</template>
                    </el-input>
                    </el-form-item>
                </el-col>
            </el-form-item>

            <el-form-item
                    label="保证金(元)">
                <el-col :sm="20" :md="12" style="padding-right: 15px">
                    <el-form-item
                            prop="bzj">
                    <el-input
                            size="small"
                            placeholder="请输入质量保证金"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.bzj">
                        <template slot="prepend">质量</template>
                    </el-input></el-form-item>
                </el-col>
                <el-col :sm="20" :md="12" style="padding-right: 15px">
                    <el-form-item
                            prop="zlbzj">
                    <el-input
                            size="small"
                            placeholder="请输入租赁保证金"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.zlbzj">
                        <template slot="prepend">租赁</template>
                    </el-input></el-form-item>
                </el-col>
            </el-form-item>
            <el-form-item style="margin-bottom: 80px">
                <el-col :sm="20" :md="12" style="padding-right: 15px">
                    <el-form-item
                            prop="wybzj">
                    <el-input
                            size="small"
                            placeholder="请输入物业保证金"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.wybzj">
                        <template slot="prepend">物业</template>
                    </el-input>
                    </el-form-item>
                </el-col>
                <el-col :sm="20" :md="12" style="padding-right: 15px">
                    <el-form-item
                            prop="qtbzj">
                    <el-input
                            size="small"
                            placeholder="请输入其他保证金"
                            :verify-number="true"
                            :clearable="false"
                            :disabled="readOnly"
                            v-model="form.qtbzj">
                        <template slot="prepend">其他</template>
                    </el-input></el-form-item>
                </el-col>
            </el-form-item>

            <el-divider content-position="center">4. 广告位置</el-divider>

            <div v-for="(item, index) in form.adList" :key="index">
                <el-form-item :label="adLabel(index)">
                    <el-col :sm="20" :md="9">
                        <el-form-item
                                :prop="'adList.'+index + '.location'"
                                :rules="[
                                { required: true, message: '请输入广告位置', trigger: 'blur' }
                            ]">
                            <el-input
                                    size="small"
                                    type="textarea"
                                    :autosize="{ minRows: 1, maxRows: 2}"
                                    placeholder="位置"
                                    :disabled="readOnly"
                                    v-model="form.adList[index].location">
                                <template slot="prepend">位置</template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                    <el-col :sm="20" :md="7">
                        <el-form-item
                                :prop="'adList.'+index + '.cost'"
                                :rules="[
                                { required: true, message: '请输入广告租金', trigger: 'blur' }
                            ]">
                            <el-input
                                    size="small"
                                    placeholder="租金"
                                    :disabled="readOnly"
                                    v-model="form.adList[index].cost">
                                <template slot="prepend">租金</template>
                                <template slot="append">元</template>
                            </el-input>
                        </el-form-item>
                    </el-col>
                    <el-col class="line hidden-sm-and-down" :span="1">&nbsp;</el-col>
                    <el-col :sm="20" :md="5">
                        <span style="color: #10B0C6; cursor: pointer;" v-if="!readOnly" v-on:click="removeAd(index)">
                            <i class="el-icon-delete" style="margin-right: 6px;"></i>移除广告位
                        </span>
                    </el-col>
                    <el-col :sm="20" :md="16" class="upload">
                        <el-form-item
                                :prop="'adList.'+index + '.url'"
                                :rules="[
                                { required: true, message: '请上传广告图', trigger: 'change' }
                            ]">
                            <el-upload
                                    accept="image/jpeg,image/png"
                                    :ref="'adUpload_' + index"
                                    list-type="picture-card"
                                    :limit="1"
                                    :disabled="readOnly"
                                    :action="uploadAction"
                                    :on-success="handleAdSuccess.bind(null, {'index':index,'data':item})"
                                    :on-remove="handleAdRemove.bind(null, {'index':index,'data':item})">
                                <img v-if="item.url" :src="item.url" class="img dynamic">
                                <i v-else class="el-icon-plus"></i>
                            </el-upload>
                            <el-dialog :visible.sync="zswztimgDialogVisible">
                                <img width="100%" :src="form.zswztimg" alt="">
                            </el-dialog>
                        </el-form-item>
                    </el-col>

                </el-form-item>
            </div>

            <el-form-item v-if="!readOnly">
                <span v-on:click="addAd" style="color: #10B0C6; cursor: pointer"><i class="el-icon-circle-plus" style="margin-right: 6px"></i>新增广告位</span>
            </el-form-item>

            <el-form-item label="备注">
                <el-input
                        size="small"
                        type="textarea"
                        :autosize="{ minRows: 1, maxRows: 2}"
                        placeholder="请输入备注"
                        :disabled="readOnly"
                        v-model="form.bz"
                />
            </el-form-item>

        </el-form>

        <!-- <div class="console-bar">
            <el-button size="small" v-on:click="goBack">
                <i class="el-icon-arrow-left" style="margin-right: 10px;"></i>返回</el-button>
        </div> -->

        <div style="text-align: right">
            <el-button size="small" class="btybtn" v-on:click="btnKeep" v-if="!readOnly" type="primary">保存</el-button>
            <el-button size="small" class="btybtn" v-on:click="pass" v-if="auditbtn == 1" type="primary">通过</el-button>
            <el-button size="small" v-on:click="reject" v-if="auditbtn == 1" type="danger">驳回</el-button>
            <el-button size="small" v-on:click="goBack">返回</el-button>
        </div>
    </div>
</div>

<script>
    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }

    const proId = '${id}'
    const __swedit = '${swedit}'
    const auditbtn = [${auditbtn}]
    const swInfo = [${list}][0][0]
    var app = new Vue({
        el: '#app',
        data: {
            proId: proId,
            auditbtn: auditbtn,
            uploadAction: '/task/uploads',
            zswztimgDialogVisible: false,
            readOnly: false,
            zswztimgList: [],
            form: {
                itemAddress: '',
                zswztimg: '', // 落位图
                kfry: '', // 开发人员
                ry: '', // 手机
                sw: '', // 招商人员
                djr: '', // 手机
                zlArea: '', // 租赁实用面积
                zlAreaBuild: '', // 租赁建筑面积
                waibaiArea: '', // 外摆区面积
                zlTime: '', // 租赁月数
                zlTime1: '', // 天数
                mzTime: '', // 免租月数
                mzTime1: '', // 天数

                ccxst: '', // 租金抽成
                qt: '', // 其他形式
                waterFee: '', // 水费
                eleFee: '', // 电费
                wuyeFee: '', // 物业费
                bzj: '', // 保证金
                zlbzj: '', // 租赁保证金
                wybzj: '', // 物业保证金
                qtbzj: '', // 其他保证金

                taxes: ['', '', ''],
                adList: [],

                bz: ''
            },
            rules: {
                zswztimg: [
                    { required: true, message: '请上传落位图 ', trigger: 'change' }
                ],
                itemAddress: [
                    { required: true, message: '请输入项目地址', trigger: 'blur' }
                ],
                kfry: [
                    { required: true, message: '请输入开发人员姓名', trigger: 'blur' }
                ],
                ry: [
                    { required: true, message: '请输入开发人员手机号', trigger: 'blur' }
                ],
                sw: [
                    { required: true, message: '请输入商务人员姓名', trigger: 'blur' }
                ],
                djr: [
                    { required: true, message: '请输入商务人员手机号', trigger: 'blur' }
                ],
                // zlArea: [
                //     { required: true, message: '请输入租赁实用面积', trigger: 'blur' }
                // ],
                zlTime: [
                    { required: true, message: '请输入租赁月数', trigger: 'blur' }
                ],
                waterFee: [
                    { required: true, message: '请输入水费', trigger: 'blur' }
                ],
                eleFee: [
                    { required: true, message: '请输入电费', trigger: 'blur' }
                ],
                wuyeFee: [
                    { required: true, message: '请输入物业费', trigger: 'blur' }
                ],
            },
            adList: [],
        },
        mounted() {
            console.log(swInfo)
            if(__swedit != 1) this.readOnly = true
            this.getThings()
        },
        methods: {
            goBack() {
                window.history.back()
            },
            pass() {
                this.$confirm('确认通过该商务条件？', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.shenHe(1, this.proId)
                }).catch(() => {
                    // this.$message({
                    //     type: 'info',
                    //     message: '已取消删除'
                    // });
                });
            },
            reject() {
                this.$prompt('请输入驳回理由', '驳回', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    inputValidator: (value) => {
                        if(!value) {//对输入内容校验
                            return '驳回原因不能为空！';
                        }
                    }
                }).then(({ value }) => {
                    this.shenHe(0, this.proId, value)
                    // this.$message({
                    //     type: 'success',
                    //     message: '已驳回'
                    // })
                }).catch(() => {

                })
            },
            shenHe(data, id, reason) {
                let obj = {};
                obj.proId = Number(id);
                obj.status = data;
                obj.taskId = 6;
                obj.content = reason;
                let formData = new FormData();

                let _url = '/taskStatus/audit?proId=' + Number(id) + '&status=' + data + '&taskId=6'

                if(reason) {
                    _url = _url + '&content=' + reason
                }

                const requestOptions = {
                    method: "POST",
                    headers: { "Content-Type": "application/x-www-form-urlencoded" }
                };
                fetch(_url, requestOptions)
                    .then(response => response.json())
                    .then(data => {
                            if(data.success) {
                                let msg = obj.status == 1 ? '已确认！' : '已驳回'
                                this.auditbtn = 0
                                this.$message({
                                    type: 'success',
                                    message: msg
                                })
                            } else {
                                this.$message({
                                    type: 'error',
                                    message: data.message
                                })
                            }
                        }

                    )
            },
            addRent() {
                this.form.taxes.push('')
            },
            getThings() {
                let keys = Object.keys(this.form)
                for(let i in keys) {
                    if(keys[i] !== 'adList' && keys[i] !== 'taxes') {
                        let obj = swInfo.filter(item => item.pinCode == keys[i])
                        if(keys[i] == 'zlAreaBuild') {
                            if(obj.length == 1) {
                                this.form[keys[i]] = swInfo.filter(item => item.pinCode == keys[i])[0].data
                            } else {
                                this.form[keys[i]] = ''
                            }
                        } else {
                            let _info = swInfo.filter(item => item.pinCode == keys[i])
                            this.form[keys[i]] = _info.length ? _info[0].data : ''
                        }
                    }
                }

                // 把swInfo没有的新字段放在这里加入到form 否则vue会出错
                //if(this.form.hasOwnProperty('zlAreaBuild') == false) this.form.zlAreaBuild = ''

                // 落位图
                if(this.form.zswztimg) {
                    let obj = {
                        url: this.form.zswztimg
                    }

                    this.zswztimgList.push(obj)
                }

                // 租金
                let obj1 = []
                let taxes = swInfo.filter(item => item.pinCode.indexOf('year') != -1)
                for(let i in taxes) {
                    obj1.push(taxes[i].data)
                }
                this.form.taxes = obj1

                // 广告
                let obj2 = {}
                let adLocation = swInfo.filter(item => item.pinCode.slice(0, 2) == 'wz')
                let adCost = swInfo.filter(item => item.pinCode.slice(0, 2) == 'zj')
                let adImg = swInfo.filter(item => item.pinCode.indexOf('adImg') != -1)
                for(let i in adLocation) {
                    this.form.adList.push({
                        location: adLocation[i].data,
                        cost: adCost[i].data,
                        url: adImg[i].data,
                        img: adImg[i].data
                    })

                    let temp = []
                    temp.push({url: adImg[i].data})
                    this.adList.push(temp)
                }
            },
            removeTaxes() {
                this.form.taxes.splice(this.form.taxes.length - 1, 1)
            },
            removeAd(index) {
                this.form.adList.splice(index, 1)
            },
            addAd() {
                this.form.adList.push({
                    location: '',
                    cost: '',
                    url: '',
                    img: ''
                })
            },
            adLabel(index) {
                 return '广告' + (Number(index) + 1)
            },
            adImg(index) {
                if(this.form.adList[index].url !== 'undefined') {
                    let obj = [{'url':this.form.adList[index].url}]
                    return obj
                }
            },
            handleZswztimgSuccess(response, file, fileList) {
                if(response.msg == '上传成功') {
                    this.form.zswztimg = response.data.src
                    this.$refs['form'].validateField('zswztimg')
                }
            },
            handleZswztimgRemove(file, fileList) {
                this.form.zswztimg = ''
                console.log(file, fileList);
                setTimeout(() => {
                    this.$refs['form'].validateField('zswztimg')
                }, 800)
            },
            handleZswztimgPictureCardPreview(file) {
                this.zswztimgDialogVisible = true;
            },
            handleAdSuccess(obj, response, file) {
                let index = obj.index
                if(response.msg == '上传成功') {
                    this.form.adList[index].url = response.data.src
                    this.form.adList[index].img = response.data.src

                    this.$refs['form'].validateField('adList.' + index + '.url')
                }
            },
            handleAdRemove(obj, file, fileList) {
                let index = obj.index
                this.form.adList[index].url = ''
                this.form.adList[index].img = ''
                this.$forceUpdate()
                this.$refs['form'].validateField('adList.' + index + '.url')
                // console.log(file, fileList);
            },
            btnKeep() {
                this.$refs['form'].validate((valid) => {
                    if (valid) {

                        this.$refs['form'].validateField('zswztimg')

                        let params = Object.entries(this.form)
                        let taxes = this.form.taxes
                        let query = []
                        let ads = this.form.adList

                        params.forEach((value, key, arr) => {
                            if(value[0] != 'taxes' && value[0] != 'adList') {
                                let obj = {
                                    data: value[1],
                                    pinCode: value[0],
                                    sort: key
                                }

                                if(value[0] == 'itemAddress') {
                                    obj.proId = this.proId
                                    obj.mouldId = '36'
                                }
                                query.push(obj)
                            }
                        })

                        for(let i in taxes) {
                            let obj = {
                                //data: taxes[1], 20210930 bug 居然没人发现 一直传的第二年的租金
                                data: taxes[i],
                                pinCode: 'year' + (Number(i) + 1),
                                sort: query.length
                            }
                            query.push(obj)
                        }

                        for(let i in ads) {
                            let code = i == 0 ? '' : i
                            let obj = {
                                data: ads[i].location,
                                pinCode: 'wz' + code,
                                sort: query.length
                            }
                            let obj1 = {
                                data: ads[i].cost,
                                pinCode: 'zj' + code,
                                sort: query.length + 1
                            }
                            let obj2 = {
                                data: ads[i].img,
                                pinCode: 'adImg' + code,
                                sort: query.length + 2
                            }
                            query.push(obj)
                            query.push(obj1)
                            query.push(obj2)
                        }

                        console.log(query)

                        const requestOptions = {
                            method: "POST",
                            headers: { "Content-Type": "application/json" },
                            body: JSON.stringify(query)
                        };
                        fetch("/mouldBoardMsg/add", requestOptions)
                            .then(response => response.json())
                            .then(data => {
                                    if(data.success) {
                                        this.$message({
                                            type: 'success',
                                            message: '已提交待审核'
                                        })
                                        setTimeout(() => {
                                            this.goBack()
                                        }, 1200)
                                    } else {
                                        this.$message({
                                            type: 'error',
                                            message: data.message
                                        })
                                    }
                                }

                            )
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                })

            },
        }
    })
</script>
</body>

<!---------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------------------------->
<!---------------------------------------------------------------------------------------------------------------------------->

@}